package com.fm.lockhart.listener;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.LinkedList;
import java.util.List;
import java.util.function.BiConsumer;

public class ListenerTasks {
	private static List<BiConsumer<HttpServletRequest, HttpServletResponse>> tasks = new LinkedList<>();

	public static void appendTask(BiConsumer<HttpServletRequest, HttpServletResponse> consumer) {
		tasks.add(consumer);
	}

	public static void executeTasks(HttpServletRequest request, HttpServletResponse response) {
		tasks.forEach(action -> action.accept(request, response));
	}
}
